using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Data;
using System.Windows;
using System.Globalization;

namespace MyPublisher.Windows.Controls.Primitives
{
    public class DataConverterBool2Visibility : IValueConverter
    {
        private static DataConverterBool2Visibility _instance;
        public static DataConverterBool2Visibility Instance
        {
            get
            {
                if (null == _instance)
                    _instance = new DataConverterBool2Visibility();
                return _instance;
            }
        }

        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return ((bool)value) ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return (Visibility)value == Visibility.Visible;
        }

        #endregion
    }
}
